package com.piece.core.message.enums;

import com.piece.core.framework.util.collection.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 短信渠道
 */
@Getter
@AllArgsConstructor
public enum SmsChannelType {

    DING_TALK("DING_TALK", "钉钉"),
    YUN_PIAN("YUN_PIAN", "云片"),
    ALIYUN("ALIYUN", "阿里云"),
    TENCENT("TENCENT", "腾讯云");

    /**
     * 编码
     */
    private final String code;
    /**
     * 名字
     */
    private final String name;

    public static SmsChannelType getByCode(String code) {
        return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values());
    }
}